﻿<UserControl x:Class="Synrc.SyncAndContacts"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:local="clr-namespace:Synrc" Height="80" Width="400" Margin="0">
    <UserControl.Resources>
       
        <Style TargetType="{x:Type Label}" BasedOn="{StaticResource {x:Type Label}}">
            <Setter Property="Margin" Value="2"/>
        </Style>

        <LinearGradientBrush x:Key="ButtonNormalBackground"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#F3F3F3"
                          Offset="0"/>
                <GradientStop Color="#EBEBEB"
                          Offset="0.5"/>
                <GradientStop Color="#DDDDDD"
                          Offset="0.5"/>
                <GradientStop Color="#CDCDCD"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>

        <Style x:Key="ButtonFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle Margin="2"
                               StrokeThickness="1"
                               Stroke="Black"
                               StrokeDashArray="1 2"
                               SnapsToDevicePixels="true"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <SolidColorBrush x:Key="ButtonNormalBorder"
                     Color="#FF707070"/>

        <Style x:Key="BaseButtonStyle"
           TargetType="{x:Type local:DropDownButton}">
            <Setter Property="FocusVisualStyle"
                Value="{StaticResource ButtonFocusVisual}"/>
            <Setter Property="Background"
                Value="{StaticResource ButtonNormalBackground}"/>
            <Setter Property="BorderBrush"
                Value="{StaticResource ButtonNormalBorder}"/>
            <Setter Property="BorderThickness"
                Value="1"/>
            <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="HorizontalContentAlignment"
                Value="Center"/>
            <Setter Property="VerticalContentAlignment"
                Value="Center"/>
            <Setter Property="Padding"
                Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:DropDownButton}">
                        <mwt:ButtonChrome Name="Chrome"
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        RenderDefaulted="{TemplateBinding Button.IsDefaulted}"
                                        RenderMouseOver="{TemplateBinding IsMouseOver}"
                                        RenderPressed="{TemplateBinding IsPressed}"
                                        SnapsToDevicePixels="true">
                            <ContentPresenter Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          RecognizesAccessKey="True"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </mwt:ButtonChrome>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsKeyboardFocused"
                                 Value="true">
                                <Setter TargetName="Chrome"
                                    Property="RenderDefaulted"
                                    Value="true"/>
                            </Trigger>
                            <Trigger Property="ToggleButton.IsChecked"
                                 Value="true">
                                <Setter TargetName="Chrome"
                                    Property="RenderPressed"
                                    Value="true"/>
                            </Trigger>
                            <Trigger Property="IsEnabled"
                                 Value="false">
                                <Setter Property="Foreground"
                                    Value="#ADADAD"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <Style x:Key="{x:Type Button}"
           BasedOn="{StaticResource BaseButtonStyle}"
           TargetType="{x:Type Button}"/>
        
        <Style x:Key="{x:Type local:DropDownButton}"
           BasedOn="{StaticResource BaseButtonStyle}"
           TargetType="{x:Type local:DropDownButton}"/>

        <LinearGradientBrush x:Key="ProgressBarBorderBrush"
                         EndPoint="0,1"
                         StartPoint="0,0">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#B2B2B2"
                          Offset="0"/>
                <GradientStop Color="#8C8C8C"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ProgressBarBackground"
                         EndPoint="1,0"
                         StartPoint="0,0">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#BABABA"
                          Offset="0"/>
                <GradientStop Color="#C7C7C7"
                          Offset="0.5"/>
                <GradientStop Color="#BABABA"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ProgressBarTopHighlight"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#80FFFFFF"
                          Offset="0.05"/>
                <GradientStop Color="#00FFFFFF"
                          Offset="0.25"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ProgressBarGlassyHighlight"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#50FFFFFF"
                          Offset="0.5385"/>
                <GradientStop Color="#00FFFFFF"
                          Offset="0.5385"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ProgressBarIndicatorGlassyHighlight"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#90FFFFFF"
                          Offset="0.5385"/>
                <GradientStop Color="#00FFFFFF"
                          Offset="0.5385"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectLeft"
                         RadiusX="1"
                         RadiusY="1"
                         RelativeTransform="1,0,0,1,0.5,0.5">
            <RadialGradientBrush.GradientStops>
                <GradientStop Color="#60FFFFC4"
                          Offset="0"/>
                <GradientStop Color="#00FFFFC4"
                          Offset="1"/>
            </RadialGradientBrush.GradientStops>
        </RadialGradientBrush>
        <LinearGradientBrush x:Key="ProgressBarIndicatorLightingEffect"
                         StartPoint="0,1"
                         EndPoint="0,0">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#60FFFFC4"
                          Offset="0"/>
                <GradientStop Color="#00FFFFC4"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectRight"
                         RadiusX="1"
                         RadiusY="1"
                         RelativeTransform="1,0,0,1,-0.5,0.5">
            <RadialGradientBrush.GradientStops>
                <GradientStop Color="#60FFFFC4"
                          Offset="0"/>
                <GradientStop Color="#00FFFFC4"
                          Offset="1"/>
            </RadialGradientBrush.GradientStops>
        </RadialGradientBrush>

        <LinearGradientBrush x:Key="ProgressBarIndicatorDarkEdgeLeft"
                         StartPoint="0,0"
                         EndPoint="1,0">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#0C000000"
                          Offset="0"/>
                <GradientStop Color="#20000000"
                          Offset="0.3"/>
                <GradientStop Color="#00000000"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ProgressBarIndicatorDarkEdgeRight"
                         StartPoint="0,0"
                         EndPoint="1,0">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#00000000"
                          Offset="0"/>
                <GradientStop Color="#20000000"
                          Offset="0.7"/>
                <GradientStop Color="#0C000000"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" 
                         MappingMode="Absolute"
                         StartPoint="-100,0"
                         EndPoint="0,0">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#00000000"
                          Offset="0"/>
                <GradientStop Color="#FF000000"
                          Offset="0.4"/>
                <GradientStop Color="#FF000000"
                          Offset="0.6"/>
                <GradientStop Color="#00000000"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>

        <Style x:Key="{x:Type ProgressBar}"
           TargetType="{x:Type ProgressBar}">
            <Setter Property="Foreground"
                Value="#01D328"/>
            <Setter Property="Background"
                Value="{StaticResource ProgressBarBackground}"/>
            <Setter Property="BorderBrush"
                Value="{StaticResource ProgressBarBorderBrush}"/>
            <Setter Property="BorderThickness"
                Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ProgressBar}">
                        <Grid Name="Background"
                          SnapsToDevicePixels="true">
                            <Rectangle Fill="{TemplateBinding Background}"
                                   RadiusX="2"
                                   RadiusY="2"/>
                            <Border Background="{StaticResource ProgressBarGlassyHighlight}"
                                Margin="1"
                                CornerRadius="2"/>
                            <Border BorderBrush="#80FFFFFF"
                                Background="{StaticResource ProgressBarTopHighlight}"
                                BorderThickness="1,0,1,1"
                                Margin="1"/>
                            <Rectangle Name="PART_Track"
                                   Margin="1"/>

                            <Decorator x:Name="PART_Indicator"
                                   HorizontalAlignment="Left"
                                   Margin="1">
                                <Grid Name="Foreground">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition MaxWidth="15"/>
                                        <ColumnDefinition Width="0.1*"/>
                                        <ColumnDefinition MaxWidth="15"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Rectangle x:Name="Indicator"
                                           Grid.RowSpan="2"
                                           Grid.ColumnSpan="3"
                                           Fill="{TemplateBinding Foreground}"/>
                                    <Rectangle x:Name="Animation"
                                           Grid.RowSpan="2"
                                           Grid.ColumnSpan="3"
                                           Fill="{TemplateBinding Foreground}">
                                        <Rectangle.OpacityMask>
                                            <MultiBinding>
                                                <MultiBinding.Converter>
                                                    <mwt:ProgressBarHighlightConverter/>
                                                </MultiBinding.Converter>
                                                <Binding Source="{StaticResource ProgressBarIndicatorAnimatedFill}"/>
                                                <Binding Path="ActualWidth"
                                                     ElementName="Background"/>
                                                <Binding Path="ActualHeight"
                                                     ElementName="Background"/>
                                            </MultiBinding>
                                        </Rectangle.OpacityMask>
                                    </Rectangle>
                                    <Rectangle x:Name="LeftDark"
                                           Grid.RowSpan="2"
                                           Fill="{StaticResource ProgressBarIndicatorDarkEdgeLeft}"
                                           RadiusX="1"
                                           RadiusY="1"
                                           Margin="1,1,0,1"/>
                                    <Rectangle x:Name="RightDark"
                                           Grid.RowSpan="2"
                                           Grid.Column="2"
                                           RadiusX="1"
                                           RadiusY="1"
                                           Fill="{StaticResource ProgressBarIndicatorDarkEdgeRight}"
                                           Margin="0,1,1,1"/>
                                    <Rectangle x:Name="LeftLight"
                                           Grid.Column="0"
                                           Grid.Row="2"
                                           Fill="{StaticResource ProgressBarIndicatorLightingEffectLeft}"/>
                                    <Rectangle x:Name="CenterLight"
                                           Grid.Column="1"
                                           Grid.Row="2"
                                           Fill="{StaticResource ProgressBarIndicatorLightingEffect}"/>
                                    <Rectangle x:Name="RightLight"
                                           Grid.Column="2"
                                           Grid.Row="2"
                                           Fill="{StaticResource ProgressBarIndicatorLightingEffectRight}"/>
                                    <Border x:Name="Highlight1"
                                        Grid.RowSpan="2"
                                        Grid.ColumnSpan="3"
                                        Background="{StaticResource ProgressBarIndicatorGlassyHighlight}"/>
                                    <Border x:Name="Highlight2"
                                        Grid.RowSpan="2" 
                                        Grid.ColumnSpan="3"
                                        Background="{StaticResource ProgressBarTopHighlight}"/>
                                </Grid>
                            </Decorator>

                            <Border BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                CornerRadius="2"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="Orientation"
                                 Value="Vertical">
                                <Setter TargetName="Background"
                                    Property="LayoutTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="-90"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="PART_Track"
                                    Property="LayoutTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="90"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="PART_Indicator"
                                    Property="LayoutTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="90"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="Foreground"
                                    Property="LayoutTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="-90"/>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>

                            <Trigger Property="IsIndeterminate"
                                 Value="true">
                                <Setter TargetName="LeftDark"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                                <Setter TargetName="RightDark"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                                <Setter TargetName="LeftLight"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                                <Setter TargetName="CenterLight"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                                <Setter TargetName="RightLight"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                                <Setter TargetName="Indicator"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                            </Trigger>
                            <Trigger Property="IsIndeterminate"
                                 Value="false">
                                <Setter TargetName="Animation"
                                    Property="Fill"
                                    Value="#80B5FFA9"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- ContextMenu -->

        <Style x:Key="{x:Type ContextMenu}"
           TargetType="{x:Type ContextMenu}">
            <Setter Property="Background"
                Value="#F5F5F5"/>
            <Setter Property="FontFamily"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
            <Setter Property="FontSize"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
            <Setter Property="FontStyle"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
            <Setter Property="FontWeight"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
            <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
            <Setter Property="VerticalContentAlignment"
                Value="Center"/>
            <Setter Property="BorderThickness"
                Value="1"/>
            <Setter Property="BorderBrush"
                Value="#FF959595"/>
            <Setter Property="Padding"
                Value="2"/>
            <Setter Property="Grid.IsSharedSizeScope"
                Value="true"/>
            <Setter Property="HasDropShadow"
                Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ContextMenu}">
                        <mwt:SystemDropShadowChrome Name="Shdw"
                                                  Color="Transparent"
                                                  SnapsToDevicePixels="true">
                            <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                                <Grid>
                                    <Rectangle Fill="#F1F1F1"
                                           HorizontalAlignment="Left"
                                           Width="28"
                                           Margin="2"
                                           RadiusX="2"
                                           RadiusY="2"/>
                                    <Rectangle HorizontalAlignment="Left"
                                           Width="1"
                                           Margin="30,2,0,2"
                                           Fill="#E2E3E3"/>
                                    <Rectangle HorizontalAlignment="Left"
                                           Width="1"
                                           Margin="31,2,0,2"
                                           Fill="White"/>


                                    <ScrollViewer CanContentScroll="true"
                                              Grid.ColumnSpan="2" Margin="1,0"
                                              Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                        <ItemsPresenter Margin="{TemplateBinding Padding}"
                                                    KeyboardNavigation.DirectionalNavigation="Cycle"
                                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                    </ScrollViewer>
                                </Grid>
                            </Border>
                        </mwt:SystemDropShadowChrome>
                        <ControlTemplate.Triggers>
                            <Trigger Property="HasDropShadow"
                                 Value="true">
                                <Setter TargetName="Shdw"
                                    Property="Margin"
                                    Value="0,0,5,5"/>
                                <Setter TargetName="Shdw"
                                    Property="Color"
                                    Value="#71000000"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        
        <!-- Expander -->

        <Style x:Key="ExpanderHeaderFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border>
                            <Rectangle Margin="0"
                                   StrokeThickness="1"
                                   Stroke="Black"
                                   StrokeDashArray="1 2"
                                   SnapsToDevicePixels="true"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush x:Key="ExpanderArrowFill"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="White"
                          Offset="0"/>
                <GradientStop Color="#FFBFBFBF"
                          Offset="0.5"/>
                <GradientStop Color="#FF878787"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ExpanderArrowHoverFill"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#FFF0F8FE"
                          Offset="0"/>
                <GradientStop Color="#FFE0F3FE"
                          Offset="0.3"/>
                <GradientStop Color="#FF6FA7C5"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="ExpanderArrowPressedFill"
                         StartPoint="0,0"
                         EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="#FFDCF0FA"
                          Offset="0"/>
                <GradientStop Color="#FFC5E6F7"
                          Offset="0.2"/>
                <GradientStop Color="#FF5690D0"
                          Offset="1"/>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        <Style x:Key="ExpanderDownHeaderStyle"
           TargetType="{x:Type ToggleButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Border Padding="{TemplateBinding Padding}">
                            <Grid Background="Transparent"
                              SnapsToDevicePixels="False">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="19"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Ellipse x:Name="circle"
                                     Width="19"
                                     Height="19"
                                     Stroke="DarkGray"
                                     HorizontalAlignment="Center"
                                     VerticalAlignment="Center"
                                     Fill="{DynamicResource ExpanderArrowFill}"/>
                                <Path x:Name="arrow"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center"
                                  Stroke="#666"
                                  StrokeThickness="2"
                                  SnapsToDevicePixels="false"
                                  Data="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                <ContentPresenter Grid.Column="1"
                                              Margin="4,0,0,0"
                                              HorizontalAlignment="Left"
                                              VerticalAlignment="Center"
                                              SnapsToDevicePixels="True"
                                              RecognizesAccessKey="True"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked"
                                 Value="true">
                                <Setter Property="Data"
                                    Value="M 1,4.5  L 4.5,1  L 8,4.5"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF3C7FB1"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowHoverFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#222"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsPressed"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF526C7B"
                                    TargetName="circle"/>
                                <Setter Property="StrokeThickness"
                                    Value="1.5"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowPressedFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#FF003366"
                                    TargetName="arrow"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ExpanderUpHeaderStyle"
           TargetType="{x:Type ToggleButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Border Padding="{TemplateBinding Padding}">
                            <Grid Background="Transparent"
                              SnapsToDevicePixels="False">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="19"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid>
                                    <Grid.LayoutTransform>
                                        <TransformGroup>
                                            <TransformGroup.Children>
                                                <TransformCollection>
                                                    <RotateTransform Angle="180"/>
                                                </TransformCollection>
                                            </TransformGroup.Children>
                                        </TransformGroup>
                                    </Grid.LayoutTransform>
                                    <Ellipse x:Name="circle"
                                         Width="19"
                                         Height="19"
                                         Stroke="DarkGray"
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
                                         Fill="{DynamicResource ExpanderArrowFill}"/>
                                    <Path x:Name="arrow"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Stroke="#666"
                                      StrokeThickness="2"
                                      SnapsToDevicePixels="false"
                                      Data="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                </Grid>
                                <ContentPresenter Grid.Column="1"
                                              Margin="4,0,0,0"
                                              HorizontalAlignment="Left"
                                              VerticalAlignment="Center"
                                              SnapsToDevicePixels="True"
                                              RecognizesAccessKey="True"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked"
                                 Value="true">
                                <Setter Property="Data"
                                    Value="M 1,4.5  L 4.5,1  L 8,4.5"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF3C7FB1"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowHoverFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#222"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsPressed"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF526C7B"
                                    TargetName="circle"/>
                                <Setter Property="StrokeThickness"
                                    Value="1.5"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowPressedFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#FF003366"
                                    TargetName="arrow"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ExpanderLeftHeaderStyle"
           TargetType="{x:Type ToggleButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Border Padding="{TemplateBinding Padding}">
                            <Grid Background="Transparent"
                              SnapsToDevicePixels="False">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="19"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Grid>
                                    <Grid.LayoutTransform>
                                        <TransformGroup>
                                            <TransformGroup.Children>
                                                <TransformCollection>
                                                    <RotateTransform Angle="90"/>
                                                </TransformCollection>
                                            </TransformGroup.Children>
                                        </TransformGroup>
                                    </Grid.LayoutTransform>
                                    <Ellipse x:Name="circle"
                                         Width="19"
                                         Height="19"
                                         Stroke="DarkGray"
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
                                         Fill="{DynamicResource ExpanderArrowFill}"/>
                                    <Path x:Name="arrow"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Stroke="#666"
                                      StrokeThickness="2"
                                      SnapsToDevicePixels="false"
                                      Data="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                </Grid>
                                <ContentPresenter Grid.Row="1"
                                              Margin="0,4,0,0"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Top"
                                              SnapsToDevicePixels="True"
                                              RecognizesAccessKey="True"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked"
                                 Value="true">
                                <Setter Property="Data"
                                    Value="M 1,4.5  L 4.5,1  L 8,4.5"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF3C7FB1"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowHoverFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#222"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsPressed"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF526C7B"
                                    TargetName="circle"/>
                                <Setter Property="StrokeThickness"
                                    Value="1.5"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowPressedFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#FF003366"
                                    TargetName="arrow"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ExpanderRightHeaderStyle"
           TargetType="{x:Type ToggleButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Border Padding="{TemplateBinding Padding}">
                            <Grid Background="Transparent"
                              SnapsToDevicePixels="False">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="19"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Grid>
                                    <Grid.LayoutTransform>
                                        <TransformGroup>
                                            <TransformGroup.Children>
                                                <TransformCollection>
                                                    <RotateTransform Angle="-90"/>
                                                </TransformCollection>
                                            </TransformGroup.Children>
                                        </TransformGroup>
                                    </Grid.LayoutTransform>
                                    <Ellipse x:Name="circle"
                                         Width="19"
                                         Height="19"
                                         Stroke="DarkGray"
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
                                         Fill="{DynamicResource ExpanderArrowFill}"/>
                                    <Path x:Name="arrow"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Stroke="#666"
                                      StrokeThickness="2"
                                      SnapsToDevicePixels="false"
                                      Data="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                </Grid>
                                <ContentPresenter Grid.Row="1"
                                              Margin="0,4,0,0"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Top"
                                              SnapsToDevicePixels="True"
                                              RecognizesAccessKey="True"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked"
                                 Value="true">
                                <Setter Property="Data"
                                    Value="M 1,4.5  L 4.5,1  L 8,4.5"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF3C7FB1"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowHoverFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#222"
                                    TargetName="arrow"/>
                            </Trigger>
                            <Trigger Property="IsPressed"
                                 Value="true">
                                <Setter Property="Stroke"
                                    Value="#FF526C7B"
                                    TargetName="circle"/>
                                <Setter Property="StrokeThickness"
                                    Value="1.5"
                                    TargetName="circle"/>
                                <Setter Property="Fill"
                                    Value="{DynamicResource ExpanderArrowPressedFill}"
                                    TargetName="circle"/>
                                <Setter Property="Stroke"
                                    Value="#FF003366"
                                    TargetName="arrow"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="{x:Type Expander}"
           TargetType="{x:Type Expander}">
            <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="Background"
                Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment"
                Value="Stretch"/>
            <Setter Property="VerticalContentAlignment"
                Value="Stretch"/>
            <Setter Property="BorderBrush"
                Value="Transparent"/>
            <Setter Property="BorderThickness"
                Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Expander}">
                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            CornerRadius="3"
                            SnapsToDevicePixels="true">
                            <DockPanel>
                                <ToggleButton x:Name="HeaderSite"
                                          DockPanel.Dock="Top"
                                          Margin="1"
                                          MinWidth="0"
                                          MinHeight="0"
                                          Style="{StaticResource ExpanderDownHeaderStyle}"
                                          FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}"
                                          IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                                          Content="{TemplateBinding Header}"
                                          ContentTemplate="{TemplateBinding HeaderTemplate}"
                                          ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                          Foreground="{TemplateBinding Foreground}"
                                          Padding="{TemplateBinding Padding}"
                                          FontFamily="{TemplateBinding FontFamily}"
                                          FontSize="{TemplateBinding FontSize}"
                                          FontStyle="{TemplateBinding FontStyle}"
                                          FontStretch="{TemplateBinding FontStretch}"
                                          FontWeight="{TemplateBinding FontWeight}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                <ContentPresenter x:Name="ExpandSite"
                                              DockPanel.Dock="Bottom"
                                              Visibility="Collapsed"
                                              Focusable="false"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              Margin="{TemplateBinding Padding}"/>
                            </DockPanel>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsExpanded"
                                 Value="true">
                                <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="ExpandSite"/>
                            </Trigger>
                            <Trigger Property="ExpandDirection"
                                 Value="Right">
                                <Setter Property="DockPanel.Dock"
                                    Value="Right"
                                    TargetName="ExpandSite"/>
                                <Setter Property="DockPanel.Dock"
                                    Value="Left"
                                    TargetName="HeaderSite"/>
                                <Setter Property="Style"
                                    Value="{StaticResource ExpanderRightHeaderStyle}"
                                    TargetName="HeaderSite"/>
                            </Trigger>
                            <Trigger Property="ExpandDirection"
                                 Value="Up">
                                <Setter Property="DockPanel.Dock"
                                    Value="Top"
                                    TargetName="ExpandSite"/>
                                <Setter Property="DockPanel.Dock"
                                    Value="Bottom"
                                    TargetName="HeaderSite"/>
                                <Setter Property="Style"
                                    Value="{StaticResource ExpanderUpHeaderStyle}"
                                    TargetName="HeaderSite"/>
                            </Trigger>
                            <Trigger Property="ExpandDirection"
                                 Value="Left">
                                <Setter Property="DockPanel.Dock"
                                    Value="Left"
                                    TargetName="ExpandSite"/>
                                <Setter Property="DockPanel.Dock"
                                    Value="Right"
                                    TargetName="HeaderSite"/>
                                <Setter Property="Style"
                                    Value="{StaticResource ExpanderLeftHeaderStyle}"
                                    TargetName="HeaderSite"/>
                            </Trigger>
                            <Trigger Property="IsEnabled"
                                 Value="false">
                                <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- End Expander -->
        
        <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
            <Style.Triggers>
                <MultiTrigger>
                    <MultiTrigger.Conditions>
                        <Condition Property="TextBox.IsFocused" Value="false" />
                        <Condition Property="TextBox.Text" Value="" />
                    </MultiTrigger.Conditions>
                    <Setter Property="Background">
                        <Setter.Value>
                            <VisualBrush Stretch="None" AlignmentX="Left" AlignmentY="Center">
                                <VisualBrush.Visual>
                                    <TextBlock Name="TextBlock1" Margin="2" Foreground="Gray">
                                        Search Contacts
                                    </TextBlock>
                                </VisualBrush.Visual>
                            </VisualBrush>
                        </Setter.Value>
                    </Setter>
                </MultiTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type Menu}" BasedOn="{StaticResource {x:Type Menu}}">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#4B90Df" Offset="0" />
                        <GradientStop Color="#295591" Offset=".5" />
                        <GradientStop Color="#183D76" Offset="0.51" />
                        <GradientStop Color="#325F9E" Offset="1" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>

        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" x:Key="topWhiteToBottomTransparentGradientBrush">
            <LinearGradientBrush.GradientStops>
                <GradientStop Color="White" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>

        <ControlTemplate x:Key="GlassButton" TargetType="{x:Type ToggleButton}">
            <ControlTemplate.Resources>
                <Storyboard x:Key="Timeline1">
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="Timeline2">
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </ControlTemplate.Resources>
            <Border BorderThickness="1,1,1,1" CornerRadius="7,2,2,7">
                <Border x:Name="border" BorderThickness="1,1,1,1" CornerRadius="7,2,2,7">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="0.507*"/>
                            <RowDefinition Height="0.493*"/>
                        </Grid.RowDefinitions>
                        <Border BorderBrush="Gray" Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="7,2,2,7">
                            <Border.Background>
                                <RadialGradientBrush>
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1.702" ScaleY="2.243"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="0"/>
                                            <TranslateTransform X="-0.368" Y="-0.152"/>
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="LightBlue" Offset="0"/>
                                    <GradientStop Color="LightBlue" Offset="1"/>
                                </RadialGradientBrush>
                            </Border.Background>
                        </Border>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/>
                        <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
                                    <GradientStop Color="LightBlue" Offset="0"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                    </Grid>
                </Border>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Opacity" TargetName="shine" Value="0.7"/>
                    <Setter Property="Background" TargetName="border" Value="LightBlue"/>
                    <Setter Property="Visibility" TargetName="glow" Value="Hidden"/>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource Timeline1}"/>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard x:Name="Timeline2_BeginStoryboard" Storyboard="{StaticResource Timeline2}"/>
                    </Trigger.ExitActions>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </UserControl.Resources>
    
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="45" />
            <RowDefinition Height="202*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="456*" />
        </Grid.ColumnDefinitions>
        <ProgressBar Name="progressBar" Maximum="0" Visibility="Collapsed" Margin="80,12,0,8" />
        <Label Margin="80,10,0,8" Name="statusLabel" VerticalContentAlignment="Center" Foreground="RoyalBlue" HorizontalContentAlignment="Center" Visibility="Hidden">Syncronizing...</Label>
        <Expander Header="Contacts" Margin="0,43,-1,0" Name="expander" Grid.RowSpan="2" Collapsed="expander1_Collapsed" Expanded="expander1_Expanded" FlowDirection="RightToLeft" IsExpanded="False">
     
            <Grid>
                <local:SearchTextBox Search="SearchTextBox_Search" Margin="-1,1.538,-1,0" SearchMode="Instant" FlowDirection="LeftToRight" Height="20.763" VerticalAlignment="Top" />
                <ListView ItemsSource="{Binding}" Style="{DynamicResource ListViewStyle}" 
                          Background="{StaticResource topWhiteToBottomTransparentGradientBrush}" BorderThickness="0" 
                          Name="ContactsView" Margin="-1,28.453,-1,-1" FlowDirection="LeftToRight">
                    <!--SelectionChanged="ListView_SelectionChanged"> -->

                    <ListView.ItemContainerStyle>
                        <Style TargetType="{x:Type ListViewItem}">
                            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                            <Setter Property="VerticalContentAlignment" Value="Center" />
                        </Style>
                    </ListView.ItemContainerStyle>
                    <ListView.View>
                        <GridView>
                            <GridView.ColumnHeaderContainerStyle>
                                <Style TargetType="{x:Type GridViewColumnHeader}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </Style>
                            </GridView.ColumnHeaderContainerStyle>
                            <GridViewColumn Header="Name" Width="{Binding Path=ListView.Width}">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                            <Label Width="Auto" Grid.Row="0" Padding="0" Margin="0" FontSize="14" Content="{Binding Path=FullName}" />
                                            <Label Width="Auto" Grid.Row="1" Padding="0" Margin="0" Foreground="Gray" Content="{Binding Path=EMail}" />
                                            <Label Width="Auto" Grid.Row="2" Padding="0" Margin="0" Foreground="Gray" Content="{Binding Path=Phone}" />
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
                <Label Margin="80,-22,-1,0" Name="statusMessage" FlowDirection="LeftToRight" Height="26" VerticalAlignment="Top"></Label>
            </Grid>
        </Expander>

        <local:DropDownButton
            Content="Sync" x:Name="syncButton" Margin="0,12,0,8" HorizontalAlignment="Left" Width="74">

            <local:DropDownButton.DropDown>
                <ContextMenu>
                    <MenuItem Name="WindowsContacts" Header="Windows Contacts" Click="SyncWindowsContacts" />
                    <MenuItem Name="WindowsLive" Header="Windows Live" Click="SyncLiveContacts" />
                    <MenuItem Name="Outlook" Header="Microsoft Outlook" Click="SyncOutlookPIM" />
                    <MenuItem Name="Google" Header="Google" Click="SyncGMAIL" />
                </ContextMenu>
            </local:DropDownButton.DropDown>
        </local:DropDownButton>
        <StackPanel Margin="80,8,-1,8" Name="stackPanel" Orientation="Horizontal">
            <Label Name="lastSyncMessage" VerticalContentAlignment="Center" Visibility="Hidden" Height="27" Width="Auto" HorizontalContentAlignment="Left">Last Sync was made with Google</Label>
            <Label Name="url" VerticalContentAlignment="Center" Visibility="Hidden" Width="Auto" Height="26" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                <Hyperlink Click="Hyperlink_Click" NavigateUri="http://synrc.com">Unlock!</Hyperlink>
            </Label>
        </StackPanel>
    </Grid>
</UserControl>
